import json

import pytest

from conftest import BASE_DIR

#构造测试数据
#
# def build_data():
#     test_data = []
#     file = BASE_DIR + r"/data/thems.json"
#     with open(file, encoding="utf-8") as f:
#         json_data = json.load(f)
#
#         for case_data in json_data:
#             #desc=case_data.get("desc")
#             ids = case_data.get("ids")
#             msg = case_data.get("msg")
#             error_code = case_data.get("error_code")
#
#
#             test_data.append((ids,msg,error_code))
#         print(test_data)
#
#     return test_data
#
# if __name__ == '__main__':
#     build_data()


test_data = []
a=[{"ids": "1","msg": "xx","error_code":"1"},{"ids": "2","msg": "qq","error_code":"12"}]
b=['ids', 'msg', 'error_code']
for j in a:
    for aa in b:
        bb=j.get(aa)
        test_data.append(bb)
print(test_data)





    #return    test_data

data=["ids",'msg','error_code']
#build_data(data)

# # a = [{"ids": "1", "msg": "xx", "error_code": 1}, {"ids": "2", "msg": "qq", "error_code": 12}]
# #
# # d=[]
# # i=0
# # for b in a:
# #     print(b)
# #     for c in data:
# #         print(b[c])
# #         d.append(b[c])
# #     print(d.append(b[c]))
#
#
#
def d():
    zz = ['1', 'xx', "1", '2', 'qq', "12"]
    # ans = ",".join(map(str, zz))
    # print(ans)  # 1,xx,1,2,qq,12
    #
    # xx=(ans.split())
    # print(xx)
    tup = ()
    num = len(zz)/3
    print(num)   #2.0

    for n in range(int(num)):
        server_info = list()
        for i in range(3):
            server_info.append(zz.pop(0))
        tup1 = (server_info,)
        tup = tup + tup1
        del server_info
    return tup

print(d())



